package com.thinkpadteam.edugra.fragment;

import com.thinkpadteam.edugra.R;
import com.thinkpadteam.edugra.R.id;
import com.thinkpadteam.edugra.R.layout;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.RelativeLayout;
import android.widget.Toast;
import android.widget.VideoView;

public class LessonConclution extends Activity{

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_conclution);
		
		VideoView vd = (VideoView)findViewById(R.id.video_player_view);
		Uri urivideo= Uri.parse(getIntent().getStringExtra("urivideo"));
		Log.d("urivideo", "zz "+ ""+urivideo);
//		Toast.makeText(this, urivideo, Toast.LENGTH_SHORT).show();
		RelativeLayout lesson_act = (RelativeLayout) findViewById(R.id.layout_conclution);
		lesson_act.setBackgroundResource(R.drawable.bg_makan_v2);
		
//		Uri uri = Uri.parse("android.resource://com.thinkpadteam.edugra/"+R.raw.videomakan);
//		Uri uri = (Uri)getIntent().getExtras().get(Intent.EXTRA_STREAM);	//success
//		vd.setVideoURI(uri);
		vd.setVideoURI(urivideo);				
		vd.setMediaController(new MediaController(this));
		vd.requestFocus();
		vd.start();
		
		vd.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
			
			@Override
			public void onCompletion(MediaPlayer mp) {
				onBackPressed();
//				Intent intent = new Intent(LessonConclution.this, LessonMakan.class);
//				startActivity(intent);
				
			}
		});
		
		
	}

}
